#pragma once

#include "OgreExIPort.h"
#include "OgreExMessageHandlerBase.h"
#include "OgreExMessageHandler.h"
#include "OgreExAddress.h"
namespace OgreEx
{
	class IMessage;
	class HandlerThreadBase;
	class AsynPort : public IPort
	{
	public:
		__DeclareAddress(AsynPort);

	public:
		AsynPort();
		virtual ~AsynPort();
		
		//typedef void (IPort::*HandlerFunction)(IMessage* msg);
	public:
		virtual void send(IMessage* msg);
		virtual void post(IMessage* msg);
		virtual void handle(IMessage* msg);
		virtual void setThread(HandlerThreadBase* thread);


	protected:
		SafeQueue<IMessage*> mMsgQueue;
		HandlerThreadBase * mThread;
	};


}